#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#define MaxSize 100
#define ElemType char
typedef struct
{
    ElemType data[MaxSize];
    int top;
}SqStack;
void init(SqStack*);//初始化
bool is_empty(SqStack*);//判断是否为空
bool is_full(SqStack* pS);//判断是否已满
bool push(SqStack*,ElemType );//入栈
bool pop(SqStack*,ElemType *);//出栈，返回原栈顶元素
bool bracketCheck(SqStack*,ElemType [] );//括号匹配检查
int main()
{
    SqStack S;
    init(&S);
    ElemType arr[MaxSize];
    scanf("%s",arr);
    if(bracketCheck(&S,arr))
    {
        printf("Yes!\n");
    }
    else
    {
        printf("No!\n");
    }
    return 0;
}
void init(SqStack* pS)//初始化
{
    pS->top = -1;
    return;
}
bool is_empty(SqStack* pS)//判断是否为空
{
    if(pS->top == -1)
        return true;
    return false;
}
bool is_full(SqStack* pS)//判断是否已满
{
    if(pS->top == MaxSize-1)
        return true;
    return false;
}
bool push(SqStack* pS,ElemType val)//入栈
{
    if(is_full(pS))
    {
        return false;
    }
    pS->data[++pS->top] = val;
    return true;
}
bool pop(SqStack* pS,ElemType *pVal)//出栈，返回原栈顶元素
{
    if(is_empty(pS))
    {
        return false;
    }
    *pVal = pS->data[pS->top--];
    return true;    
}
bool bracketCheck(SqStack* pS,ElemType arr[])//括号匹配检查
{
    ElemType val;
    while(*arr)
    {
        if(*arr == '('||*arr == '['||*arr == '{')
        {
            push(pS,*arr);
        }
        else
        {

        if(*arr == ')')
        {
            if(!pop(pS,&val))
                return false;
            if(val != '(')
                return false;
        }
        if(*arr == ']')
        {
            if(!pop(pS,&val))
                return false;    
            if(val != '[')
                return false;
        }
        if(*arr == '}')
        {
            if(!pop(pS,&val))
                return false;
            if(val != '{')
                return false;
        }


        }
        
        arr++;
    }
    return is_empty(pS);
}